﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="cong.aspx.cs" Inherits="Doanhnghiep_cong" Title="Untitled Page" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
       
           <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
    <table cellpadding="0" cellspacing="0"  style="margin-left:50px;">
    <tr><td colspan="3" align="center"><h2>Thêm mới Cống xã</h2></td></tr>
            <tr>
                <td style="width: 100px; height: 19px;">
                    Tencong<br />
                    <asp:TextBox ID="txtten" runat="server"/></td>
                    
                <td style="width: 100px; height: 19px;">

                    KCN<br />
                     <telerik:RadComboBox ID="cb_kcn" runat="server"  AllowCustomText="true" AutoPostBack="true"
                        onselectedindexchanged="cb_kcn_SelectedIndexChanged"
                        DataTextField="TenKCN" DataValueField="Makcn" DataSourceID="sql1"></telerik:RadComboBox></td>
                        
                <td style="width: 100px; height: 19px;">
                   DN<br />
                    <telerik:RadComboBox ID="cb_dn" runat="server"></telerik:RadComboBox>
     
        <asp:SqlDataSource ID="sql1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
            SelectCommand="SELECT * FROM [Khucongnghiep]"></asp:SqlDataSource>
                    </td>
             
             </tr>
             <tr>
                <td style="width: 100px; height: 19px;">
                    Thuộc KCN<br />
                    <asp:CheckBox ID="CheckBox1" runat="server" Checked="true" Enabled="false"/></td>
                <td style="width: 100px; height: 19px;">
                    Tọa độ X<br />
                    <asp:TextBox ID="txtX" runat="server"/></td>
                <td style="width: 100px; height: 19px;">
                    Tọa độ Y<br />
                    <asp:TextBox ID="txtY" runat="server"/></td>
              </tr>
              <tr>
                <td style="width: 100px; height: 19px;" colspan="3">
                    Ghi chú<br />
                    <telerik:RadEditor ID="RadEditor1" runat="server" Width="500px" Height="200px">
                        <Tools>
                        
                            <telerik:EditorToolGroup Tag="MainToolbar">
                                <telerik:EditorTool Name="FindAndReplace" />
                                <telerik:EditorSeparator />
                                <telerik:EditorSplitButton Name="Undo">
                                </telerik:EditorSplitButton>
                                <telerik:EditorSplitButton Name="Redo">
                                </telerik:EditorSplitButton>
                                <telerik:EditorSeparator />
                                <telerik:EditorTool Name="Cut" />
                                <telerik:EditorTool Name="Copy" />
                                <telerik:EditorTool Name="Paste" ShortCut="CTRL+V" />
                            </telerik:EditorToolGroup>                           
                        </Tools>
                        <Content></Content>
                    </telerik:RadEditor></td>
               </tr>
           
             <tr>
                <td style="width: 100px">
                   </td>
            </tr>
        </table><br />
     </ContentTemplate>
 </asp:UpdatePanel>
 <table cellpadding="0" cellspacing="0"  style="margin-left:50px;">
 <tr><td>
  <telerik:RadButton ID="Button1" runat="server" Text="Add New" OnClick="Button1_Click" />
  </td>
  <td style="width:20px"></td>
  <td>
  <telerik:RadButton ID="refesh" runat="server" Text="Refesh" onclick="refesh_Click"></telerik:RadButton>
  </td>
  </tr></table><br />
      <asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080"></asp:Label>
        <asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000"></asp:Label>  
    <telerik:RadGrid ID="RadGrid_congxa" runat="server" AllowPaging="True" 
            AllowSorting="True" CellSpacing="0"
            GridLines="None" AllowAutomaticDeletes="True" AutoGenerateColumns="False"
            AllowAutomaticUpdates="True" OnItemUpdated="RadGrid_congxa_ItemUpdated"
             
           
            Skin="Telerik" 
             onselectedindexchanged="RadGrid_congxa_SelectedIndexChanged" DataSourceID="SqlDataSource1">
        

            <MasterTableView DataKeyNames="Macong" DataSourceID="SqlDataSource1">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
            <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>

            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
            <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>

    <Columns>
        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        
                    </telerik:GridEditCommandColumn>
        <telerik:GridBoundColumn DataField="Macong" 
            FilterControlAltText="Filter Macong column" HeaderText="Macong" 
            UniqueName="Macong" DataType="System.Int32" ReadOnly="True" 
            SortExpression="Macong" Visible="false">
        </telerik:GridBoundColumn>
          <telerik:GridTemplateColumn HeaderText="STT">
                       <ItemTemplate>
                        <asp:Label runat="server" ID="lblSTT" Text='<%#i++%>'></asp:Label>
                       </ItemTemplate>
           </telerik:GridTemplateColumn> 
           <telerik:GridBoundColumn DataField="Tencong" 
            FilterControlAltText="Filter Tencong column" HeaderText="Tencong" 
            SortExpression="Tencong" UniqueName="Tencong">
        </telerik:GridBoundColumn>  
         <telerik:GridDropDownColumn DataField="Makcn" DataSourceID="Congxa_kcn" EnableEmptyListItem="true"
                        HeaderText="Khu công nghiệp" ListTextField="TenKCN" ListValueField="Makcn" 
                        UniqueName="Makcn" ColumnEditorID="GridDropDownKCN">
        </telerik:GridDropDownColumn>
        <telerik:GridDropDownColumn DataField="Madnghiep" DataSourceID="Congxa_dn"
                        HeaderText="Doanhnghiep" ListTextField="TenDN" ListValueField="Madnghiep"
                        UniqueName="Madnghiep" ColumnEditorID="GridDropDownDN">
        </telerik:GridDropDownColumn> 
        
        
        
        <telerik:GridCheckBoxColumn DataField="ThuocKCN" DataType="System.Boolean" HeaderText="Thuộc KCN" 
        UniqueName="ThuocKCN" ColumnEditorID="checkkcn">
        </telerik:GridCheckBoxColumn>
        
        <telerik:GridNumericColumn DataField="ToadoX" 
            FilterControlAltText="Filter ToadoX column" HeaderText="ToadoX" SortExpression="ToadoX" 
            UniqueName="ToadoX">
        </telerik:GridNumericColumn>
        <telerik:GridNumericColumn DataField="ToadoY" 
            FilterControlAltText="Filter ToadoY column" HeaderText="ToadoY" 
            SortExpression="ToadoY" UniqueName="ToadoY">
        </telerik:GridNumericColumn>
        <telerik:GridHTMLEditorColumn DataField="Ghichu"
            FilterControlAltText="Filter Ghichu column" HeaderText="Ghichu" 
            SortExpression="Ghichu" UniqueName="Ghichu" ColumnEditorID="Ghichu">
        </telerik:GridHTMLEditorColumn>
         <telerik:GridButtonColumn ConfirmText="Delete this Congxa?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridButtonColumn>
    </Columns>

<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>

<FilterMenu EnableImageSprites="False"></FilterMenu>
        
    </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
        SelectCommand="SELECT * FROM [Congxa]"
         DeleteCommand="DELETE FROM [Congxa] WHERE [Macong] = @original_Macong"
           UpdateCommand="UPDATE [Congxa] SET [Madnghiep] = @Madnghiep,[Makcn]=@Makcn, [Tencong] = @Tencong, [ToadoX] = @ToadoX, [ToadoY] = @ToadoY,[Ghichu]=@Ghichu,[ThuocKCN]=@ThuocKCN WHERE [Macong] = @original_Macong"
           
          OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
         
          
          <DeleteParameters>
               <asp:Parameter Name="original_Macong" Type="Int32" />
           </DeleteParameters>
           <UpdateParameters>
               <asp:Parameter Name="Madnghiep" Type="Int32" />
               <asp:Parameter Name="Makcn" Type="Int32" />
               <asp:Parameter Name="Tencong" Type="String" />
               <asp:Parameter Name="ToadoX" Type="String" />
               <asp:Parameter Name="ToadoY" Type="String" />
               <asp:Parameter Name="Ghichu" Type="String" />
                <asp:Parameter Name="ThuocKCN" Type="Boolean" />
               
               <asp:Parameter Name="original_Macong" Type="Int32" />
               
               
           </UpdateParameters>

      </asp:SqlDataSource>
        <asp:SqlDataSource ID="Congxa_dn" runat="server" 
           ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
           SelectCommand="SELECT TOP 20 * FROM [Doanhnghiep]">
             
         </asp:SqlDataSource>
         
             <asp:SqlDataSource ID="Congxa_kcn" runat="server" 
           ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
           SelectCommand="SELECT TOP 20 * FROM [Khucongnghiep] ">
         </asp:SqlDataSource>
</asp:Content>

